<table class="table table-border table-bordered table-hover table-bg">
	<thead>
		<tr class="text-c">
			<th width="25"><input type="checkbox" value="" name=""></th>
			<th>编号</th>
			<th>门锁串号</th>
			<th>中控网关</th>
			<th>指令类型</th>
			<th>指令内容</th>
			<th>用户昵称</th>
			<th>有效时间</th>
			<th>设置时间</th>
		</tr>
	</thead>
	<tbody>
		<?php if(is_array($locklist) && count($locklist)){ ?>
		<?php foreach($locklist as $k=>$user){ ?>
		<tr class="text-c" id="room_{$user['lock_id']}">
			<td><input type="checkbox" value="{$user['lock_id']}" name=""></td>
			<td><?php echo ($page-1)* C('PAGE_SIZE') + $k + 1; ?></td>
			<td>{$user['lock_sn']}</td>
			<td>{$user['lock_boxsn']}</td>
			<td>
				<?php 
					switch($user['cmd_type']){
						case 0:
							echo '<input class="btn btn-primary size-S radius" type="button" value="控制指令">';
						break;
						case 1:
							echo '<input class="btn btn-secondary size-S radius" type="button" value="指纹用户">';
						break;
						case 2:
							echo '<input class="btn btn-success size-S radius" type="button" value="密码用户">';
						break;
						case 3:
							echo '<input class="btn btn-warning size-S radius" type="button" value="临时密码">';
						break;
					}
				?>
			</td>
			<td>
				<?php
					$cmd_content = empty($user['cmd_content']) ? 3 : $user['cmd_content'];

					switch($cmd_content){
						case 0:
							echo '<input class="btn btn-primary size-S radius" type="button" value="反锁">';
						break;
						case 1:
							echo '<input class="btn btn-secondary size-S radius" type="button" value="开锁">';
						break;
						case '':
							echo '---';
						break;
						default:
							echo '---';
						break;
					}
				?>
			</td>
			<td>{$user['nickname']}</td>
			<td>{$user['b_time']|date="Y-m-d H:i", ###} ~ {$user['e_time']|date="Y-m-d H:i", ###}</td>
			<td>{$user['cmd_time']|date="Y-m-d H:i", ###}</td>
		</tr>
		<?php } }else{ ?>
		<tr class="text-c">
			<td colspan="19" >暂无数据...</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script type="text/javascript">
	$(document).ready(function(){
		$(".dels").on('click', function(){
			var obj = $(this);
			layer.confirm('确定删除该门锁吗？', {
				btn: ['确定','取消'] //按钮
			}, function(){
				$.post('index.html',{lockid: obj.attr('lockid')}, function(row){
					if(row/1){
						layer.msg('删除房间成功', {icon: 1, time: 2000}, function(){
							$("#room_"+ obj.attr('lockid')).remove();
						});
					}else{
						layer.msg('删除房间失败',{icon:0, time:2000});
					}
				});
			}, function(){
				
			});
		});
	});
</script>
<!--page-->
<include file="Common/page" />